# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-06-07
# @File : 17_python_to_java_b_function.py

'''
    # b站fp_local的 str2+b(str2) --> b方法实现
    public static final String b(String str) {
        int i;
        i iVar = q.S0(q.n1(0, Math.min(str.length() - 1, 62)), 2);
        int g = iVar.g();
        int h = iVar.h();
        int i2 = iVar.i();
        if (i2 < 0 ? g >= h : g <= h) {
            i = 0;
            while (true) {
                String substring = str.substring(g, g + 2);
                x.h(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
                i += Integer.parseInt(substring, b.a(16));
                if (g == h) {
                    break;
                }
                g += i2;
            }
        } else {
            i = 0;
        }
        e0 e0Var = e0.a;
        String format = String.format("%02x", Arrays.copyOf(new Object[]{Integer.valueOf(i % 256)}, 1));
        return format;
    }
'''

# 使用python实现b算法
iVar = "63f1f4271e56de1f1460d9a360a41197202306071539278c1a97f7e368aa1e"
g = 0
h = 60
i2 = 2
i = 0

while True:
    substring = iVar[g:g + 2]
    i += int(substring, base=16)
    if g != h:
        g += i2
        continue
    break
data = "%02x" % (i % 0x100,)
print(data)